package com.ivan.eduservice.controller;

import com.ivan.commonutils.CommonResult;
import com.ivan.eduservice.service.EduCourseService;
import com.ivan.eduservice.vo.CourseInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 课程 前端控制器
 * </p>
 *
 * @author Ivan
 * @since 2020-08-09
 */
@Api("课程管理")
@RestController
@RequestMapping("/eduservice/course")
@CrossOrigin
public class EduCourseController {

    @Autowired
    private EduCourseService courseService;

    /**
     * @Author Ivan
     * @Description 添加课程基本信息的方法
     * @Date 2020/8/9 11:41
     * @Param
     * @return
     */
    @ApiOperation(value = "添加课程基本信息")
    @PostMapping("addCourseInfo")
    public CommonResult addCourseInfo(@RequestBody CourseInfoVo courseInfoVo) {
        //返回添加之后课程id，为了后面添加大纲使用
        String id = courseService.saveCourseInfo(courseInfoVo);
        return CommonResult.success().data("courseId",id);
    }

}

